package com.kuyou.ddhm_tv.utils;

import android.util.Log;

import com.kuyou.publiclibrary.utils.ByteUtils;

public class BPJudge {

    public static String Parse(byte[] bytes){
        if (bytes.length < 4)
            return "";
        switch (bytes[2]) {
            case (byte) 0xFD:
                return  "测量异常,请穿戴好设备:";

            case (byte) 0xfb://袖带压力


                Log.d("袖带压力:", String.valueOf(ByteUtils.bytesToIntForBP(bytes[3], bytes[4])));
                
                break;
            case (byte) 0XF1://标准压力值
                 
                Log.d("标准压力值:", String.valueOf(ByteUtils.bytesToIntForBP(bytes[3],bytes[4])));
                break;
            case (byte) 0XF2://电量百分比
                Log.d("电量百分比:", String.valueOf(ByteUtils.bytesToIntForBP(bytes[3], bytes[4])));
                break;
            case (byte) 0XF3://脉搏值
                 
                Log.d("脉搏值:", String.valueOf(ByteUtils.bytesToIntForBP(bytes[3], bytes[4])));

                break;
            case (byte) 0XFC://脉搏值

               Integer.parseInt( Integer.toHexString(bytes[3] & 0xFF),16);
                Integer.parseInt( Integer.toHexString(bytes[4] & 0xFF),16);
               Integer.parseInt( Integer.toHexString(bytes[5] & 0xFF),16);

                Log.d("s高压:", ""+Integer.parseInt( Integer.toHexString(bytes[3] & 0xFF),16));
                Log.d("s低压:", ""+Integer.parseInt( Integer.toHexString(bytes[4] & 0xFF),16));
                Log.d("s心率:", ""+Integer.parseInt( Integer.toHexString(bytes[5] & 0xFF),16));
                break;
        }
        return "";
    }
}
